package com.hightop.axure.automic;

import io.appium.java_client.MobileBy;
import io.appium.java_client.windows.WindowsDriver;
import lombok.AccessLevel;
import lombok.RequiredArgsConstructor;
import lombok.experimental.FieldDefaults;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;

/**
 * Axture9 AccessibilityId
 * @author xiehai
 * @date 2022/08/30 10:08
 */
@FieldDefaults(level = AccessLevel.PRIVATE, makeFinal = true)
@RequiredArgsConstructor
enum AccessibilityIds {
    /**
     * 选择文件地址
     */
    FILE_ADDRESS("41477"),
    /**
     * 选择文件名称
     */
    FILE_NAME("1148"),
    /**
     * 选择目录名称
     */
    FOLDER_NAME("1152"),
    /**
     * 打开文件/目录按钮
     */
    FILE_OPEN_BTN("1"),
    /**
     * 退出axure否按钮
     */
    EXIT_NO_BTN("7"),
    /**
     * 发布进度条
     */
    PUBLISH_PROCESS("ProgressDialog");
    /**
     * Accessibility Id
     */
    String id;

    public WebElement get(WebDriver driver) {
        return driver.findElement(MobileBy.ByAccessibilityId.AccessibilityId(this.id));
    }

    public WebElement get(WindowsDriver<WebElement> driver) {
        return driver.findElementByAccessibilityId(this.id);
    }
}
